BIN=process
CC=gcc
LFLAGS=-o
CFLAGS=-c -std=c99
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
RM=rm -f

$(BIN):$(OBJ)
	@$(CC) $(LFLAGS) $(BIN) $(OBJ)
	@echo "链接 $^ 成为 $@"

%.o:%.c
	@$(CC) $(CFLAGS) $<
	@echo "编译 $^ 成为 $@"

.PHONY:clean
clean:
	@$(RM) $(BIN) $(OBJ)

.PHONY:print
print:
	@echo $(SRC)
	@echo "----------------------------------"
	@echo $(OBJ)
